<?php /*a:7:{s:57:"E:\code\jiaoyou\application\admin\view\content\index.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\header.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\css.html";i:1598939754;s:53:"E:\code\jiaoyou\application\admin\view\public\js.html";i:1598939754;s:58:"E:\code\jiaoyou\application\admin\view\public\tophead.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\top.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\footer.html";i:1598939753;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>后台系统</title>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/animate.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/style.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/ffxiang.css" />
<link rel="shortcut icon" href="http://jiaoyou.com\/style/admin/img/favicon.ico">
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/layui/css/layui.css" />
</head>
<style type="text/css">
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .btn-active {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <?php 
$controller=strtolower(request()->controller());
$action=strtolower(request()->action());
$adminCtegory=db('category')->where(['controller'=>$controller,'function'=>$action])->cache(_cache('db'))->find();
$admin = Session::get('admin', 'mmjtAdmin');

if ($admin['id'] != 1 && $admin['type'] != 1) {
  $auth_visit = Db::name('admin_type')->where(['id' => $admin['type']])->value('data');
  $auth_visit = json_decode($auth_visit, true);
}else{
  $auth_visit = Db::name('category')->column('id');
}
if($adminCtegory){
	$adminCtegoryTid=db('category')->where(['tid'=>$adminCtegory['id'],'hideright'=>1])->order('des asc,id asc')->cache(_cache('db'))->select();
}else{
  $adminCtegoryTid=[];
}
 ?>
<div class="">
	<?php if(is_array($adminCtegoryTid) || $adminCtegoryTid instanceof \think\Collection || $adminCtegoryTid instanceof \think\Paginator): $i = 0; $__LIST__ = $adminCtegoryTid;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;
  $get=$v['get'];
  $geturl=[]; 
  if($get){
    if(strstr($get,"|")){
      $tidexplode=explode("|",$get);
      foreach($tidexplode as $va){
        $geturl[$va]=input($va);
      }
    }else{
        $geturl[$get]=input($get);
    }
  }
  $geturl['url']='-1';
  $url=url($v['controller'].'/'.$v['function'],$geturl);
   if(in_array($v['id'],$auth_visit)): ?><a onclick="add('<?php echo htmlentities($url); ?>')" href="javascript:void(0);" class="btn btn-primary "><?php echo htmlentities($v['title']); ?></a><?php endif; ?>
  <?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<script type="text/javascript">
function add(url){
        layer.open({
          type: 2,
          title: '提示',
          shadeClose: false,
          shade: 0.2,
          area: ['90%', '90%'],
          skin:'shangchuantup',
          shift:-1,
          content: url,
          scrollbar: false,
          moveType: 1,
          moveOut: true
        }); 
}
</script>
        <div class="ibox-title">
<h5>
<?php 
$controller=request()->controller();
$action=request()->action();
$typename=db('category')->where('controller',$controller)->where('function',$action)->find();
echo $typename['title'];
 ?></h5>
</div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <a class="btn btn-default btn-outline <?php if(input('get.field/s') == ''): ?> btn-active<?php endif; ?>" href="<?php echo url('content/index'); ?>">所有内容</a>
                        <?php if(is_array($types) || $types instanceof \think\Collection || $types instanceof \think\Paginator): $i = 0; $__LIST__ = $types;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                        <a class="btn btn-default btn-outline <?php if(input('get.field/s') == 'type' && input('get.value/s') == $key): ?> btn-active<?php endif; ?>" href="<?php echo url('content/index', ['field'=>'type','value' => $key]); ?>"><?php echo htmlentities($v); ?></a>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </div>
                </div>
                <div style="display:block;clear: both;"></div>
                <div class="fixed-table-toolbar">
                    <form method="get" action="">
                        <div class="pull-left search">
                            <div class="columns columns-right btn-group pull-left">
                                <select class="form-control" name="type">
                                    <option value="-1">所有分类</option>
                                    <?php foreach($category as $id => $name): ?>
                                    <option value="<?php echo htmlentities($id); ?>" <?php if(input('get.type/d') == $id): ?>selected="selected"<?php endif; ?>><?php echo htmlentities($name); ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                            <div class="pull-right search">
                                <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px"
                                        class="btn btn-default btn-outline" type="submit">搜索
                                </button>
                            </div>
                            <div class="pull-right search">
                                <input class="form-control input-outline" type="text" name="text" placeholder="输入标题搜索" value="<?php echo input('get.text', ''); ?>" />
                            </div>
                        </div>
                    </form>
                </div>
                <div class="example">
                    <form class="form-horizontal" method="post">
                        <table data-toggle="table">
                            <thead>
                                <tr>
                                    <th class="bs-checkbox"><input type="checkbox" id="changeAll" /></th>
                                    <th data-align="center">ID</th>
                                    <th data-align="center">分类</th>
                                    <th data-align="center">发布用户</th>
                                    <th data-align="center">内容</th>
                                    <th data-align="center">活动时间</th>
                                    <th data-align="center">地点</th>
                                    <th data-align="center">类型</th>
                                    <th data-align="center">报名人数</th>
                                    <th data-align="center">发布时间</th>
                                    <th data-align="center">状态</th>
                                    <th data-align="center">管理</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                            <tr id="id<?php echo htmlentities($vo['id']); ?>">
                                <td class="bs-checkbox">
                                    <input type="checkbox" name="opt_item[]" value="<?php echo htmlentities($vo['id']); ?>">
                                </td>
                                <td><?php echo htmlentities($vo['id']); ?></td>
                                <td><?php echo htmlentities($vo['category_name']); ?></td>
                                <td><?php echo htmlentities($vo['nickname']); ?></td>
                                <td><?php echo htmlentities($vo['content']); ?></td>
                                <td>
                                    <?php if($vo['date_type'] == -1): ?>
                                        <?php echo htmlentities(date('Y-m-d H:i:s',!is_numeric($vo['begin_date'])? strtotime($vo['begin_date']) : $vo['begin_date'])); ?> - <?php echo htmlentities(date('Y-m-d H:i:s',!is_numeric($vo['end_date'])? strtotime($vo['end_date']) : $vo['end_date'])); else: ?>
                                        <?php echo htmlentities(date('Y-m-d',!is_numeric($vo['begin_date'])? strtotime($vo['begin_date']) : $vo['begin_date'])); ?> - <?php echo htmlentities($choose_list[$vo['date_type']]['name']); ?>
                                    <?php endif; ?>
                                </td>
                                <td><?php echo htmlentities($vo['location']); ?></td>
                                <td><?php echo htmlentities($vo['type']); ?></td>
                                <td><?php echo htmlentities($vo['apply_num']); ?></td>
                                <td><?php echo htmlentities(date("Y-m-d",!is_numeric($vo['create_time'])? strtotime($vo['create_time']) : $vo['create_time'])); ?></td>
                                <td>
                                    <span class="btn btn-xs <?php if($vo['audit_type'] == 1): ?>btn-default<?php else: ?>btn-primary<?php endif; ?>" <?php if($vo['audit_type'] == 3): ?>style="background-color: #414141;border-color:#414141"<?php endif; ?>>
                                        <?php switch($vo['audit_type']): case "1": ?>待审核<?php break; case "2": ?>已审核<?php break; default: ?>被拒绝
                                        <?php endswitch; ?>
                                    </span>
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                            操作 <span class="caret"></span>
                                        </div>
                                        <ul class="dropdown-menu">
                                            <li><a href="<?php echo url('content/comment', ['content_id' => $vo['id'],'back'=>-1]); ?>">查看评论</a></li>
                                            <li><a onclick="add('<?php echo url('content/add', ['id' => $vo['id']]); ?>')">修改</a></li>
                                            <li class="divider"></li>
                                            <?php if($vo['audit_type'] != 1): ?>
                                            <li><a onclick="audit(<?php echo htmlentities($vo['id']); ?>, 1)">审核</a></li>
                                            <?php endif; if($vo['audit_type'] != 2): ?>
                                            <li><a onclick="audit(<?php echo htmlentities($vo['id']); ?>, 2)">通过</a></li>
                                            <?php endif; if($vo['audit_type'] != 3): ?>
                                            <li><a onclick="audit(<?php echo htmlentities($vo['id']); ?>, 3)">拒绝</a></li>
                                            <?php endif; ?>
                                            <li class="divider"></li>
                                            <li><a onclick="del(<?php echo htmlentities($vo['id']); ?>)">删除</a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div style="float: left; height: 34px; line-height: 34px;">批量：</div>
                    <select class="form-control" id="operateType" style="width: 81px; float:left;">
                        <option value="1">审核</option>
                        <option value="2">通过</option>
                        <option value="3">拒绝</option>
                        <option value="del">删除</option>
                    </select>
                    <div class="btn btn-outline btn-default" id="operateAll" style="margin-left: 0.5%;">
                        批量操作
                    </div>
                    <div class="btn btn-outline btn-default" onclick="window.location.href='<?php echo url('index', ['order' => 'asc']); ?>'">
                        正序排序
                    </div>
                    <div class="btn btn-outline btn-default" onclick="window.location.href='<?php echo url('index', ['order' => 'desc']); ?>'">
                        倒序排序
                    </div>
                </div>
            </div>
            <hr>
            <div class="row row-lg">
                <div class="col-sm-12 pages"><?php echo $data->render(); ?></div>
            </div>
        </div>
    </div>
</div>
     
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/content.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.css" />
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/ffxiangIndex.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/common.js"></script>
</body>
</html>
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.css" />
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
    $("#changeAll").click(function () {
        if ($("#changeAll").prop('checked')) {
            $("table input[type='checkbox']").prop('checked', true);
        } else  {
            $("table input[type='checkbox']").prop('checked', false);
        }
    });
    $("#operateAll").click(function () {
        var ids = '', type = $("#operateType").val();
        $("table input[type='checkbox']").each(function () {
           if ($(this).prop('checked')){
               if (ids) ids += ',';
               ids += $(this).val();
           }
        });
        if (! ids) {
            layer.msg('请选择内容！', {icon: 5, time: 3000});
            return;
        }
        $.ajax({
            url: "<?php echo url('batchOperate'); ?>",
            type: 'POST',
            dataType: 'JSON',
            data: {ids: ids, type: type},
            success: function (res) {
                if (res.status) {
                    layer.msg(res.msg, {icon:6, time: 2500}, function () {
                        window.location.reload();
                    });
                    return;
                }
                layer.msg(res.msg, {icon: 5, time: 3000});
            },
            error: function () {
                layer.msg('网络错误！', {icon: 2, time: 3000});
            }
        });
    });
});

function add(url){
    layer.open({
        type: 2,
        title: '内容管理',
        shadeClose: false,
        shade: 0.2,
        area: ['80%', '95%'],
        skin:'shangchuantup',
        // shift:-1,
        content: url,
    });
}
function del(id){
    swal_del(id,"<?php echo url('del'); ?>", {title: '该内容'})
}
function audit(id, type) {
    $.ajax({
        url: "<?php echo url('content/audit'); ?>",
        type: 'POST',
        dataType: 'JSON',
        data: {id: id, type: type},
        success: function (res) {
            if (res.status == 1) {
                layer.msg(res.msg, {icon: 1, time: 2500}, function () {
                    window.location.reload();
                });
            } else {
                layer.msg(res.msg, {icon: 5, time: 3000});
            }
        },
        error: function () {
            layer.msg('网络错误', {icon: 2, time: 3000});
        }
    });
}
</script>